﻿using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.EntityFramework;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Security.Claims;
using System.Text;
using System.Threading.Tasks;

namespace ccq.akisi.core.Domain.User
{
    public class AkisiUser : IdentityUser
    {
        public async Task<ClaimsIdentity>
            GenerateUserIdentityAsync(UserManager<AkisiUser> manager)
        {
            var userIdentity = await manager
                .CreateIdentityAsync(this,
                    DefaultAuthenticationTypes.ApplicationCookie);

            return userIdentity;
        }

        [Display(Name = "First Name")]
        public string FirstName { get; set; }
        [Display(Name = "Last Name")]
        public string LastName { get; set; }
        
        public string DisplayName
        {
            get
            {
                return string.Format("{0}{1}", FirstName, string.IsNullOrEmpty(LastName) ? "" : string.Format(" {0}.", LastName.Substring(0, 1)));
            }
        }
    }
}
